home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 118 / cd-rom 118.iso / aplic / open / openofficeorg2.cab / style_mapping_css.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2005-01-31  |  34.4 KB  |  599 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.    $RCSfile: style_mapping_css.xsl,v $
  5.  
  6.    $Revision: 1.4 $
  7.  
  8.    last change: $Author: rt $ $Date: 2005/01/28 15:22:20 $
  9.  
  10.    The Contents of this file are made available subject to the terms of
  11.    either of the following licenses
  12.  
  13.           - GNU Lesser General Public License Version 2.1
  14.           - Sun Industry Standards Source License Version 1.1
  15.  
  16.    Sun Microsystems Inc., October, 2000
  17.  
  18.    GNU Lesser General Public License Version 2.1
  19.    =============================================
  20.    Copyright 2000 by Sun Microsystems, Inc.
  21.    901 San Antonio Road, Palo Alto, CA 94303, USA
  22.  
  23.    This library is free software; you can redistribute it and/or
  24.    modify it under the terms of the GNU Lesser General Public
  25.    License version 2.1, as published by the Free Software Foundation.
  26.  
  27.    This library is distributed in the hope that it will be useful,
  28.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30.    Lesser General Public License for more details.
  31.  
  32.    You should have received a copy of the GNU Lesser General Public
  33.    License along with this library; if not, write to the Free Software
  34.    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35.    MA  02111-1307  USA
  36.  
  37.  
  38.    Sun Industry Standards Source License Version 1.1
  39.    =================================================
  40.    The contents of this file are subject to the Sun Industry Standards
  41.    Source License Version 1.1 (the "License"); You may not use this file
  42.    except in compliance with the License. You may obtain a copy of the
  43.    License at http://www.openoffice.org/license.html.
  44.  
  45.    Software provided under this License is provided on an "AS IS" basis,
  46.    WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  47.    WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  48.    MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  49.    See the License for the specific provisions governing your rights and
  50.    obligations concerning the Software.
  51.  
  52.    The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  53.  
  54.    Copyright ┬⌐ 2002 by Sun Microsystems, Inc.
  55.  
  56.    All Rights Reserved.
  57.  
  58.    Contributor(s): _______________________________________
  59.  
  60. -->
  61. <!--
  62.     For further documentation and updates visit http://xml.openoffice.org/sx2ml
  63. -->
  64. <xsl:stylesheet version="1.0"
  65.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  66.                 xmlns:office="http://openoffice.org/2000/office"
  67.                 xmlns:style="http://openoffice.org/2000/style"
  68.                 xmlns:text="http://openoffice.org/2000/text"
  69.                 xmlns:table="http://openoffice.org/2000/table"
  70.                 xmlns:draw="http://openoffice.org/2000/drawing"
  71.                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
  72.                 xmlns:xlink="http://www.w3.org/1999/xlink"
  73.                 xmlns:number="http://openoffice.org/2000/datastyle"
  74.                 xmlns:svg="http://www.w3.org/2000/svg"
  75.                 xmlns:chart="http://openoffice.org/2000/chart"
  76.                 xmlns:dr3d="http://openoffice.org/2000/dr3d"
  77.                 xmlns:math="http://www.w3.org/1998/Math/MathML"
  78.                 xmlns:form="http://openoffice.org/2000/form"
  79.                 xmlns:script="http://openoffice.org/2000/script"
  80.                 xmlns:dc="http://purl.org/dc/elements/1.1/"
  81.                 xmlns:meta="http://openoffice.org/2000/meta"
  82.                 xmlns:config="http://openoffice.org/2001/config"
  83.                 xmlns:help="http://openoffice.org/2000/help"
  84.                 exclude-result-prefixes="office style text table draw fo xlink number svg chart dr3d math form script dc meta config help">
  85.  
  86.     <!--+++++ CSS PROPERTIES  +++++-->
  87.     <xsl:template name="write-style-properties">
  88.         <xsl:param name="globalData" />
  89.         <xsl:param name="style:properties" />
  90.  
  91.         <xsl:for-each select="$style:properties/@*">
  92.         <!-- debugEnabledMESSAGE:
  93.             <xsl:message> Name:<xsl:value-of select="name()" /> Value:<xsl:value-of select="." /></xsl:message>      -->
  94.             <!-- <!ATTLIST style:properties style:horizontal-pos (from-left|left|center|right|from-inside|inside|outside)#IMPLIED>-->
  95.             <!-- 2DO: is inside/from-inside also better showable ? -->
  96.             <!-- !!!! 2DO: Still there have to be placed a <br clear='all' /> to disable the flow!!!!-->
  97.             <!--           The OOo attribute 'style:number-wrapped-paragraphs' is currently ignored -->
  98.             <xsl:choose>
  99.                 <xsl:when test='name()="style:wrap"'>
  100.                     <xsl:choose>
  101.                         <xsl:when test='.="left"'>
  102.                             <xsl:text>float:right; </xsl:text>
  103.                         </xsl:when>
  104.                         <xsl:when test='.="right"'>
  105.                             <xsl:text>float:left; </xsl:text>
  106.                         </xsl:when>
  107.                     </xsl:choose>
  108.                 </xsl:when>
  109.                 <xsl:when test='name()="fo:clear"'>
  110.                     <xsl:text>clear:both; </xsl:text>
  111.                 </xsl:when>
  112.  
  113.                 <xsl:when test='name() = "style:horizontal-pos"'>
  114.                     <xsl:choose>
  115.                         <xsl:when test='.="left"'>
  116.                             <xsl:text>text-align:left; </xsl:text>
  117.                         </xsl:when>
  118.                         <xsl:when test='. = "right"'>
  119.                             <xsl:text>text-align:right; </xsl:text>
  120.                         </xsl:when>
  121.                         <xsl:when test='.="center"'>
  122.                             <xsl:text>text-align:center; </xsl:text>
  123.                         </xsl:when>
  124.                         <!-- 2DO: currently rest values are ignored!!
  125.                             If the property value is from-left or from-inside,
  126.                             the svg:x attribute associated with the frame element specifies
  127.                             the horizontal position of the frame.
  128.                             Otherwise the svg:x attribute is ignored for text documents.
  129.                         -->
  130.                     </xsl:choose>
  131.                 </xsl:when>
  132.                 <xsl:when test='name() = "style:vertical-pos"'>
  133.                     <xsl:choose>
  134.                         <xsl:when test='.="from-top"'>
  135.                             <xsl:text>vertical-align:top; </xsl:text>
  136.                         </xsl:when>
  137.                         <xsl:otherwise>
  138.                             <xsl:text>vertical-align:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  139.                         </xsl:otherwise>
  140.                     </xsl:choose>
  141.                 </xsl:when>
  142.                 <xsl:when test='name() = "table:align"'>
  143.                     <xsl:choose>
  144.                         <xsl:when test='.="left"'><!--
  145.                         PROBLEMS WITH MEETING MINUTES EXAMPLE
  146.                             <xsl:text>float:right; </xsl:text> -->
  147.                         </xsl:when>
  148.                         <xsl:when test='.="right"'><!--
  149.                         PROBLEMS WITH MEETING MINUTES EXAMPLE
  150.                             <xsl:text>float:left; </xsl:text> -->
  151.                         </xsl:when>
  152.                         <xsl:otherwise>
  153.                             <xsl:text>float:none; </xsl:text>
  154.                         </xsl:otherwise>
  155.                     </xsl:choose>
  156.                 </xsl:when>
  157.                 <!-- PADDING for all variations: fo:padding, fo:padding-top, fo:padding-bottom, fo:padding-left, fo:padding-right -->
  158.                 <xsl:when test='contains(name(),"fo:padding")'>
  159.                     <xsl:text>padding:</xsl:text>
  160.                     <xsl:choose>
  161.                         <xsl:when test="contains(., 'inch')">
  162.                             <xsl:value-of select="substring-before(.,'ch')" />
  163.                         </xsl:when>
  164.                         <xsl:otherwise>
  165.                             <xsl:value-of select="." />
  166.                         </xsl:otherwise>
  167.                     </xsl:choose>
  168.                     <xsl:text>; </xsl:text>
  169.                 </xsl:when>
  170.                 <!--
  171.                 fo:border
  172.                 fo:border-top
  173.                 fo:border-bottom
  174.                 fo:border-left
  175.                 fo:border-right
  176.  
  177.                     At present, all four borders must be set simultaneously by using either
  178.                     the fo:border property or by attaching all four of the other border
  179.                     properties to an item set element. In the latter case, if one or more
  180.                     of the properties is missing their values are assumed to be none. The
  181.                     only border styles supported are none or hidden, solid, and double. Any
  182.                     other border style specified is displayed as solid. Transparent borders
  183.                     are not supported and the border widths thin, medium, and thick are
  184.                     mapped to lengths. In addition, only some distinct border widths are
  185.                     supported. Unsupported widths are rounded up to the next supported
  186.                     width.
  187.                     If there are no padding properties specified within the same
  188.                     item set element, a default padding is used for sides that have a
  189.                     border. A value of 0cm is used for sides without a border.
  190.                     (cp. wd-so-xml-text.sdw)
  191.                 -->
  192.                 <xsl:when test='name()="fo:border"'>
  193.                     <xsl:choose>
  194.                         <!-- changing the distance measure: inch to in -->
  195.                         <xsl:when test="contains(., 'inch')">
  196.                             <xsl:text>border-width:</xsl:text>
  197.                             <xsl:call-template name="round-up-border-width">
  198.                                 <xsl:with-param name="value" select="substring-before(.,'ch ')" />
  199.                             </xsl:call-template>
  200.                             <xsl:text>; </xsl:text>
  201.                             <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  202.                             <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  203.                         </xsl:when>
  204.                         <xsl:when test="contains(., 'cm')">
  205.                             <xsl:text>border-width:</xsl:text>
  206.                             <xsl:call-template name="round-up-border-width">
  207.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  208.                             </xsl:call-template>
  209.                             <xsl:text>; </xsl:text>
  210.                             <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  211.                             <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  212.                         </xsl:when>
  213.                         <xsl:when test="contains(., 'pt')">
  214.                             <xsl:text>border-width:</xsl:text>
  215.                             <xsl:call-template name="round-up-border-width">
  216.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  217.                             </xsl:call-template>
  218.                             <xsl:text>; </xsl:text>
  219.                             <xsl:text>border-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  220.                             <xsl:text>border-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  221.                         </xsl:when>
  222.                     </xsl:choose>
  223.                 </xsl:when>
  224.                 <xsl:when test='name()="fo:border-top"'>
  225.                     <xsl:choose>
  226.                         <!-- changing the distance measure: inch to in -->
  227.                         <xsl:when test="contains(., 'inch')">
  228.                             <xsl:text>border-top-width:</xsl:text>
  229.                             <xsl:call-template name="round-up-border-width">
  230.                                 <xsl:with-param name="value" select="substring-before(.,'ch ')" />
  231.                             </xsl:call-template>
  232.                             <xsl:text>; </xsl:text>
  233.                             <xsl:text>border-top-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  234.                             <xsl:text>border-top-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  235.                         </xsl:when>
  236.                         <xsl:when test="contains(., 'cm')">
  237.                             <xsl:text>border-top-width:</xsl:text>
  238.                             <xsl:call-template name="round-up-border-width">
  239.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  240.                             </xsl:call-template>
  241.                             <xsl:text>; </xsl:text>
  242.                             <xsl:text>border-top-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  243.                             <xsl:text>border-top-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  244.                         </xsl:when>
  245.                         <xsl:when test="contains(., 'pt')">
  246.                             <xsl:text>border-top-width:</xsl:text>
  247.                             <xsl:call-template name="round-up-border-width">
  248.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  249.                             </xsl:call-template>
  250.                             <xsl:text>; </xsl:text>
  251.                             <xsl:text>border-top-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  252.                             <xsl:text>border-top-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  253.                         </xsl:when>
  254.                     </xsl:choose>
  255.                 </xsl:when>
  256.                 <xsl:when test='name()="fo:border-bottom"'>
  257.                     <xsl:choose>
  258.                         <!-- changing the distance measure: inch to in -->
  259.                         <xsl:when test="contains(., 'inch')">
  260.                             <xsl:text>border-bottom-width:</xsl:text>
  261.                             <xsl:call-template name="round-up-border-width">
  262.                                 <xsl:with-param name="value" select="substring-before(.,'ch ')" />
  263.                             </xsl:call-template>
  264.                             <xsl:text>; </xsl:text>
  265.                             <xsl:text>border-bottom-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  266.                             <xsl:text>border-bottom-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  267.                         </xsl:when>
  268.                         <xsl:when test="contains(., 'cm')">
  269.                             <xsl:text>border-bottom-width:</xsl:text>
  270.                             <xsl:call-template name="round-up-border-width">
  271.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  272.                             </xsl:call-template>
  273.                             <xsl:text>; </xsl:text>
  274.                             <xsl:text>border-bottom-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  275.                             <xsl:text>border-bottom-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  276.                         </xsl:when>
  277.                         <xsl:when test="contains(., 'pt')">
  278.                             <xsl:text>border-bottom-width:</xsl:text>
  279.                             <xsl:call-template name="round-up-border-width">
  280.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  281.                             </xsl:call-template>
  282.                             <xsl:text>; </xsl:text>
  283.                             <xsl:text>border-bottom-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  284.                             <xsl:text>border-bottom-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  285.                         </xsl:when>
  286.                     </xsl:choose>
  287.                 </xsl:when>
  288.                 <xsl:when test='name()="fo:border-left"'>
  289.                     <xsl:choose>
  290.                         <!-- changing the distance measure: inch to in -->
  291.                         <xsl:when test="contains(., 'inch')">
  292.                             <xsl:text>border-left-width:</xsl:text>
  293.                             <xsl:call-template name="round-up-border-width">
  294.                                 <xsl:with-param name="value" select="substring-before(.,'ch ')" />
  295.                             </xsl:call-template>
  296.                             <xsl:text>; </xsl:text>
  297.                             <xsl:text>border-left-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  298.                             <xsl:text>border-left-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  299.                         </xsl:when>
  300.                         <xsl:when test="contains(., 'cm')">
  301.                             <xsl:text>border-left-width:</xsl:text>
  302.                             <xsl:call-template name="round-up-border-width">
  303.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  304.                             </xsl:call-template>
  305.                             <xsl:text>; </xsl:text>
  306.                             <xsl:text>border-left-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  307.                             <xsl:text>border-left-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  308.                         </xsl:when>
  309.                         <xsl:when test="contains(., 'pt')">
  310.                             <xsl:text>border-left-width:</xsl:text>
  311.                             <xsl:call-template name="round-up-border-width">
  312.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  313.                             </xsl:call-template>
  314.                             <xsl:text>; </xsl:text>
  315.                             <xsl:text>border-left-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  316.                             <xsl:text>border-left-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  317.                         </xsl:when>
  318.                     </xsl:choose>
  319.                 </xsl:when>
  320.                 <xsl:when test='name()="fo:border-right"'>
  321.                     <xsl:choose>
  322.                         <!-- changing the distance measure: inch to in -->
  323.                         <xsl:when test="contains(., 'inch')">
  324.                             <xsl:text>border-right-width:</xsl:text>
  325.                             <xsl:call-template name="round-up-border-width">
  326.                                 <xsl:with-param name="value" select="substring-before(.,'ch ')" />
  327.                             </xsl:call-template>
  328.                             <xsl:text>; </xsl:text>
  329.                             <xsl:text>border-right-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  330.                             <xsl:text>border-right-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'ch '), ' ')" /><xsl:text>; </xsl:text>
  331.                         </xsl:when>
  332.                         <xsl:when test="contains(., 'cm')">
  333.                             <xsl:text>border-right-width:</xsl:text>
  334.                             <xsl:call-template name="round-up-border-width">
  335.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  336.                             </xsl:call-template>
  337.                             <xsl:text>; </xsl:text>
  338.                             <xsl:text>border-right-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  339.                             <xsl:text>border-right-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'cm '), ' ')" /><xsl:text>; </xsl:text>
  340.                         </xsl:when>
  341.                         <xsl:when test="contains(., 'pt')">
  342.                             <xsl:text>border-right-width:</xsl:text>
  343.                             <xsl:call-template name="round-up-border-width">
  344.                                 <xsl:with-param name="value" select="substring-before(.,' ')" />
  345.                             </xsl:call-template>
  346.                             <xsl:text>; </xsl:text>
  347.                             <xsl:text>border-right-style:</xsl:text><xsl:value-of select="substring-before(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  348.                             <xsl:text>border-right-color:</xsl:text><xsl:value-of select="substring-after(substring-after(.,'pt '), ' ')" /><xsl:text>; </xsl:text>
  349.                         </xsl:when>
  350.                     </xsl:choose>
  351.                 </xsl:when>
  352.                 <xsl:when test='name()="style:column-width"'>
  353.                     <xsl:text>width:</xsl:text>
  354.                     <xsl:choose>
  355.                         <!-- changing the distance measure: inch to in -->
  356.                         <xsl:when test="contains(., 'inch')">
  357.                             <xsl:value-of select="substring-before(.,'ch')" />
  358.                         </xsl:when>
  359.                         <xsl:otherwise>
  360.                             <xsl:value-of select="." />
  361.                         </xsl:otherwise>
  362.                     </xsl:choose>
  363.                     <xsl:text>; </xsl:text>
  364.                 </xsl:when>
  365.                 <xsl:when test='name()="style:row-height"'>
  366.                     <xsl:text>height:</xsl:text>
  367.                     <xsl:choose>
  368.                         <!-- changing the distance measure: inch to in -->
  369.                         <xsl:when test="contains(., 'inch')">
  370.                             <xsl:value-of select="substring-before(.,'ch')" />
  371.                         </xsl:when>
  372.                         <xsl:otherwise>
  373.                             <xsl:value-of select="." />
  374.                         </xsl:otherwise>
  375.                     </xsl:choose>
  376.                     <xsl:text>; </xsl:text>
  377.                 </xsl:when>
  378.                 <xsl:when test='name()="style:width"'>
  379.                     <xsl:text>width:</xsl:text>
  380.                     <xsl:choose>
  381.                         <!-- changing the distance measure: inch to in -->
  382.                         <xsl:when test="contains(., 'inch')">
  383.                             <xsl:value-of select="substring-before(.,'ch')" />
  384.                         </xsl:when>
  385.                         <xsl:otherwise>
  386.                             <xsl:value-of select="." />
  387.                         </xsl:otherwise>
  388.                     </xsl:choose>
  389.                     <xsl:text>; </xsl:text>
  390.                 </xsl:when>
  391.                 <!-- frame property -->
  392.                 <xsl:when test='name()="fo:width"'>
  393.                     <xsl:text>width:</xsl:text>
  394.                     <xsl:choose>
  395.                         <!-- changing the distance measure: inch to in -->
  396.                         <xsl:when test="contains(., 'inch')">
  397.                             <xsl:value-of select="substring-before(.,'ch')" />
  398.                         </xsl:when>
  399.                         <xsl:otherwise>
  400.                             <xsl:value-of select="." />
  401.                         </xsl:otherwise>
  402.                     </xsl:choose>
  403.                     <xsl:text>; </xsl:text>
  404.                 </xsl:when>
  405.                 <xsl:when test='name()="fo:font-style"'>
  406.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  407.                 </xsl:when>
  408.                 <xsl:when test='name()="style:font-name"'>
  409.                     <xsl:text>font-family:</xsl:text>
  410.                     <xsl:variable name="content" select="." />
  411.                     <xsl:value-of select="$globalData/office:font-decls/style:font-decl[@style:name=$content]/@fo:font-family" />
  412.                     <xsl:text>; </xsl:text>
  413.                     <xsl:if test="contains($globalData/office:font-decls/style:font-decl[@style:name=$content]/@style:font-style-name, 'Italic')">
  414.                         <xsl:text>font-style:italic; </xsl:text>
  415.                     </xsl:if>
  416.                     <xsl:if test="contains($globalData/office:font-decls/style:font-decl[@style:name=$content]/@style:font-style-name, 'Bold')">
  417.                         <xsl:text>font-weight:bold; </xsl:text>
  418.                     </xsl:if>
  419.                 </xsl:when>
  420.                 <xsl:when test='name()="fo:font-weight"'>
  421.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  422.                 </xsl:when>
  423.                 <xsl:when test='name()="fo:font-size"'>
  424.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  425.                 </xsl:when>
  426.                 <xsl:when test='name()="fo:font-family"'>
  427.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  428.                 </xsl:when>
  429.                 <xsl:when test='name()="fo:color"'>
  430.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  431.                 </xsl:when>
  432.                 <xsl:when test='name()="fo:margin-left"'>
  433.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text>
  434.                     <xsl:choose>
  435.                         <!-- changing the distance measure: inch to in -->
  436.                         <xsl:when test="contains(., 'inch')">
  437.                             <xsl:value-of select="substring-before(.,'ch')" />
  438.                         </xsl:when>
  439.                         <xsl:otherwise>
  440.                             <xsl:value-of select="." />
  441.                         </xsl:otherwise>
  442.                     </xsl:choose>
  443.                     <xsl:text>; </xsl:text>
  444.                 </xsl:when>
  445.                 <xsl:when test='name()="fo:margin-right"'>
  446.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text>
  447.                     <xsl:choose>
  448.                         <!-- changing the distance measure: inch to in -->
  449.                         <xsl:when test="contains(., 'inch')">
  450.                             <xsl:value-of select="substring-before(.,'ch')" />
  451.                         </xsl:when>
  452.                         <xsl:otherwise>
  453.                             <xsl:value-of select="." />
  454.                         </xsl:otherwise>
  455.                     </xsl:choose>
  456.                     <xsl:text>; </xsl:text>
  457.                 </xsl:when>
  458.                 <xsl:when test='name()="fo:margin-top"'>
  459.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text>
  460.                     <xsl:choose>
  461.                         <!-- changing the distance measure: inch to in -->
  462.                         <xsl:when test="contains(., 'inch')">
  463.                             <xsl:value-of select="substring-before(.,'ch')" />
  464.                         </xsl:when>
  465.                         <xsl:otherwise>
  466.                             <xsl:value-of select="." />
  467.                         </xsl:otherwise>
  468.                     </xsl:choose>
  469.                     <xsl:text>; </xsl:text>
  470.                 </xsl:when>
  471.                 <xsl:when test='name()="fo:margin-bottom"'>
  472.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text>
  473.                     <xsl:choose>
  474.                         <!-- changing the distance measure: inch to in -->
  475.                         <xsl:when test="contains(., 'inch')">
  476.                             <xsl:value-of select="substring-before(.,'ch')" />
  477.                         </xsl:when>
  478.                         <xsl:otherwise>
  479.                             <xsl:value-of select="." />
  480.                         </xsl:otherwise>
  481.                     </xsl:choose>
  482.                     <xsl:text>; </xsl:text>
  483.                 </xsl:when>
  484.                 <xsl:when test='name()="fo:line-height"'>
  485.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text>
  486.                     <xsl:choose>
  487.                         <!-- changing the distance measure: inch to in -->
  488.                         <xsl:when test="contains(., 'inch')">
  489.                             <xsl:value-of select="substring-before(.,'ch')" />
  490.                         </xsl:when>
  491.                         <xsl:otherwise>
  492.                             <xsl:value-of select="." />
  493.                         </xsl:otherwise>
  494.                     </xsl:choose>
  495.                     <xsl:text>; </xsl:text>
  496.                 </xsl:when>
  497.                 <xsl:when test='name()="fo:text-align"'>
  498.                     <!-- IMPORTANT is necessary as table cell value alignment is decided by runtime over the valuetype
  499.                          Otherwise a table cell style-class will ALWAYS be overwritten by the run-time value -->
  500.                      <xsl:choose>
  501.                         <xsl:when test="contains(., 'start')">
  502.                             <xsl:text>text-align:left ! important; </xsl:text>
  503.                         </xsl:when>
  504.                         <xsl:when test="contains(., 'end')">
  505.                             <xsl:text>text-align:right ! important; </xsl:text>
  506.                         </xsl:when>
  507.                         <xsl:otherwise>
  508.                             <xsl:text>text-align:</xsl:text><xsl:value-of select='.' /><xsl:text> ! important; </xsl:text>
  509.                         </xsl:otherwise>
  510.                     </xsl:choose>
  511.                 </xsl:when>
  512.                 <xsl:when test='name()="fo:text-indent"'>
  513.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  514.                 </xsl:when>
  515.                 <xsl:when test='name()="style:text-background-color"'>
  516.                     <xsl:text>background-color:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  517.                 </xsl:when>
  518.                 <xsl:when test='name()="fo:background-color"'>
  519.                     <xsl:text>background-color:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  520.                 </xsl:when>
  521.                 <xsl:when test='name()="style:background-image"'>
  522.                     <xsl:text>background-image:url(</xsl:text><xsl:value-of select="@xlink:href" /><xsl:text>); </xsl:text>
  523.                     <xsl:choose>
  524.                         <xsl:when test="@style:repeat = 'repeat'">
  525.                             <xsl:text>background-repeat:repeat; </xsl:text>
  526.                         </xsl:when>
  527.                         <xsl:otherwise>
  528.                             <xsl:text>background-repeat:no-repeat; </xsl:text>
  529.                         </xsl:otherwise>
  530.                     </xsl:choose>
  531.                 </xsl:when>
  532.                 <!-- text-shadow is a CSS2 feature and yet not common used in user-agents -->
  533.                 <xsl:when test='name()="fo:text-shadow"'>
  534.                     <xsl:value-of select="substring-after(name(), ':')" /><xsl:text>:</xsl:text><xsl:value-of select="." /><xsl:text>; </xsl:text>
  535.                 </xsl:when>
  536.                 <xsl:when test='name()="style:text-crossing-out"'>
  537.                     <xsl:if test='not(.="none")'>
  538.                         <xsl:text>text-decoration:line-through; </xsl:text>
  539.                     </xsl:if>
  540.                 </xsl:when>
  541.                 <xsl:when test='name()="style:text-underline"'>
  542.                     <xsl:if test='not(.="none")'>
  543.                         <xsl:text>text-decoration:underline; </xsl:text>
  544.                     </xsl:if>
  545.                 </xsl:when>
  546.                 <xsl:when test='name()="style:text-position"'>
  547.                     <xsl:if test='contains(., "sub")'>
  548.                         <xsl:text>vertical-align:sub; </xsl:text>
  549.                     </xsl:if>
  550.                     <xsl:if test='contains(., "sup")'>
  551.                         <xsl:text>vertical-align:sup; </xsl:text>
  552.                     </xsl:if>
  553.                 </xsl:when>
  554.                 <xsl:when test='name()="fo:vertical-align"'>
  555.                     <xsl:choose>
  556.                     <xsl:when test='contains(., "bottom")'>
  557.                         <xsl:text>vertical-align:bottom; </xsl:text>
  558.                     </xsl:when>
  559.                     <xsl:when test='contains(., "middle")'>
  560.                         <xsl:text>vertical-align:middle; </xsl:text>
  561.                     </xsl:when>
  562.                     <xsl:otherwise>
  563.                         <xsl:text>vertical-align:top; </xsl:text>
  564.                     </xsl:otherwise>
  565.                     </xsl:choose>
  566.                 </xsl:when>
  567.  
  568.                 <!-- debugEnabledMESSAGE:
  569.                 <xsl:otherwise>
  570.                         <xsl:message>No transformation implemented for attribute-typ <xsl:value-of select="name()" /></xsl:message>
  571.                 </xsl:otherwise>-->
  572.             </xsl:choose>
  573.         </xsl:for-each>
  574.     </xsl:template>
  575.  
  576.  
  577.     <!-- Changing border width measure to cm and
  578.          enlarging border-width to the Mozilla browser(1.6) visible minimum (0.014 cm) -->
  579.     <xsl:template name="round-up-border-width">
  580.         <xsl:param name="value" />
  581.  
  582.         <xsl:variable name="border-width-in-cm">
  583.             <xsl:call-template name="convert2cm">
  584.                 <xsl:with-param name="value" select="$value" />
  585.             </xsl:call-template>
  586.         </xsl:variable>
  587.  
  588.         <xsl:choose>
  589.             <xsl:when test="number($border-width-in-cm) < 0.014">
  590.                 <xsl:text>0.014cm</xsl:text>
  591.             </xsl:when>
  592.             <xsl:otherwise>
  593.                 <xsl:value-of select="$border-width-in-cm" /><xsl:text>cm</xsl:text>
  594.             </xsl:otherwise>
  595.         </xsl:choose>
  596.     </xsl:template>
  597.  
  598. </xsl:stylesheet>
  599.